<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.CreateSoftwareTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <p:panel header="Software">

                    <p:panelGrid columns="2">
                        <f:facet name="header">
                            <h:outputText value="Cadastro de Novo Software" />
                        </f:facet>
                        <f:facet name="footer" >
                            <p:dataTable value="#{supplyController.items}" var="item"   id="supply"  style="border:solid 1px">
                                <f:facet name="header">
                                    <h2>List</h2> 
                                </f:facet>

                                <f:facet name="footer">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>

                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="#{bundle.ListSupplyTitle_numer}"/>
                                    </f:facet>
                                    <h:outputText value="#{item.ID}"/>
                                </p:column>
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="#{bundle.ListSupplyTitle_address}"/>
                                    </f:facet>
                                    <h:outputText value="#{item.address.toString()}"/>
                                </p:column>
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="#{bundle.ListSupplyTitle_name}"/>
                                    </f:facet>
                                    <h:outputText value="#{item.name}"/>
                                </p:column>
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="#{bundle.ListSupplyTitle_ID}"/>
                                    </f:facet>
                                    <h:outputText value="#{item.ID}"/>
                                </p:column>
                                <p:column>
                                    <f:facet name="header">
                                        <h:outputText value="&nbsp;"/>
                                    </f:facet>
                                    <p:commandButton action="#{supplyController.AddSuplyOnProduct(item.ID)}" value="ADD"/>

                                </p:column>
                            </p:dataTable>
                            <h:outputText value="WebApplication     " /> <p:commandButton action="#{softwareController.create}" value="#{bundle.CreateSoftwareSaveLink}" />
                        </f:facet>
                         <h:outputLabel value="#{bundle.CreateSoftwareLabel_description}" for="description" />
                        <h:inputText id="description" value="#{softwareController.selected.description}" title="#{bundle.CreateSoftwareTitle_description}" >
                            <p:ajax update="supply" />
                        </h:inputText>    
                        <h:outputLabel value="#{bundle.CreateSoftwareLabel_version}" for="version" />
                        <h:inputText id="version" value="#{softwareController.selected.version}" title="#{bundle.CreateSoftwareTitle_version}"  />
                       
                        <h:outputLabel value="#{bundle.CreateSoftwareLabel_price}" for="price" />
                        <h:inputText id="price" value="#{softwareController.selected.price}" title="#{bundle.CreateSoftwareTitle_price}" />
                        
                        



                    </p:panelGrid>


                    <br />
                    <h:commandLink action="#{softwareController.prepareList}" value="#{bundle.CreateSoftwareShowAllLink}" immediate="true"/>
                    <br />
                    <br />
                    <h:link outcome="/home" value="#{bundle.CreateSoftwareIndexLink}"/>
                </p:panel>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
